import type { FormSchema } from '@/components/core/schema-form/';
import { UploadOutlined } from '@ant-design/icons-vue';

export const userSchemas = (): FormSchema<API.CreateUserParams>[] => [
  {
    field: 'name',
    component: 'Input',
    label: '用户姓名',
    rules: [{ required: true }],
  },
  {
    field: 'userNo',
    component: 'Input',
    label: '工号/编号',
  },
  {
    field: 'orgId',
    component: 'TreeSelect',
    label: '所属部门',
    componentProps: {
      getPopupContainer: () => document.body,
    },
    rules: [{ required: true, type: 'string' }],
  },
  {
    field: 'orgType',
    component: 'Input',
    label: '人员类型',
  },
  {
    field: 'userSex',
    component: 'Select',
    label: '性别',
    componentProps: {
      options: [
        {
          label: '男',
          value: 1,
        },
        {
          label: '女',
          value: 0,
        },
      ],
    },
  },
  {
    field: 'userAccount',
    component: 'Input',
    label: '登录帐号',
    rules: [{ required: true }],
  },
  {
    field: 'mainPost',
    component: 'Select',
    label: '主岗位',
    rules: [{ required: false, type: 'array' }],
    componentProps: {
      getPopupContainer: () => document.body,
    },
  },
  // {
  //   field: 'roles',
  //   component: 'Select',
  //   label: '所属角色',
  //   rules: [{ required: true, type: 'array' }],
  //   componentProps: {
  //     mode: 'multiple',
  //     options: orgData.rolesList.map((item) => {
  //       return {
  //         ...item,
  //         label: item.name,
  //         value: item.id,
  //       };
  //     }),
  //   },
  // },
  {
    field: 'IS_ENABLED',
    component: 'RadioGroup',
    label: '是否启用',
    defaultValue: 1,
    componentProps: {
      options: [
        {
          label: '启用',
          value: 1,
        },
        {
          label: '禁用',
          value: 0,
        },
      ],
    },
  },
  {
    field: 'IS_BUSINESS',
    component: 'RadioGroup',
    label: '是否与业务相关',
    defaultValue: 0,
    componentProps: {
      options: [
        {
          label: '是',
          value: 1,
        },
        {
          label: '否',
          value: 0,
        },
      ],
    },
  },
  {
    field: 'directLeader',
    component: 'Input',
    label: '直属领导',
  },
  {
    field: 'userStaff',
    component: 'Input',
    label: '职务',
  },
  {
    field: 'staffLevel',
    component: 'Input',
    label: '职级',
    rules: [{ type: 'number' }],
  },
  {
    field: 'phoneNumber',
    component: 'Input',
    label: '联系电话',
  },
  {
    field: 'keyWords',
    component: 'Input',
    label: '关键字',
  },
  {
    field: 'postAddress',
    component: 'Input',
    label: '邮寄地址',
  },
  {
    field: 'doubleValidation',
    component: 'Input',
    label: '双因子验证',
  },
  {
    field: 'relatedAccount',
    component: 'Input',
    label: '关联帐号',
  },
  {
    field: 'personSort',
    component: 'Input',
    label: '排序号',
    rules: [{ required: true, type: 'string' }],
  },
  {
    field: 'remark',
    component: 'Input',
    label: '备注',
  },
];
/**
 * @description 更新用户密码
 */
export const updatePswSchemas: FormSchema[] = [
  {
    field: 'password',
    component: 'Input',
    label: '新密码',
    rules: [{ required: true, type: 'string' }],
  },
];
type blankDataType=API.CreateUserParams;
export const blankData:blankDataType={
    /**
       * 用户ID
       */
    userId: '',
    /**
     * 用户姓名
     */
    name: '',
    /**
     * 工号/编号
     */
    userNo: '',
    /**
     * 部门/主单位
     */
    orgId: '',
    /**
     * 人员类别
     */
    orgType: '',
    /**
     * 性别
     */
    userSex: undefined,
    /**
     * 登录帐号
     */
    userAccount: '',
    /**
     * 部门
     */
    depts:[],
    /**
     * 主岗位
     */
    mainPost: '',
    mainPostName: '',
    /**
     * 辅助岗位
     */
    posts: [],

    /**
     * 直属领导
     */
    directLeader: '',
    leaderName:'',
    /**
     * 职务
     */
    userStaff: '',
    /**
     * 职级
     */
    staffLevel: undefined,
    /**
     * 人员图片
     */
    picture: '',
    /**
     * 联系电话
     */
    phoneNumber: '',
    /**
     * 关键字
     */
    keyWords: '',
    /**
     * 邮寄地址
     */
    postAddress: '',
    /**
     * 双因子验证
     */
    doubleValidation: '',
    /**
     * 关联帐号
     */
    relatedAccount: '',
    /**
     * 排序号
     */
    personSort: undefined,
    /**
     * 备注
     */
    remark: '',
    /**
     * 是否启用
     */
    IS_ENABLED: 1,
    /**
     * 是否业务相关
     */
    IS_BUSINESS: 0,
    };
